package section8;

class Person8_5{
    protected String name;
    protected int age;
    public Person8_5(String name,int age){
        this.age=age;
        this.name=name;
    }
    protected void show(){
        System.out.println("姓名："+name+" 年龄："+age);
    }
}
class Student8_5 extends Person8_5{
    private String department;
    public Student8_5(String name,int age,String dep){
        super(name, age);
        department=dep;
    }
    protected void show(){
        System.out.println("系列："+department);
    }
    public void subShow(){
        System.out.println("我在子类中！");
    }
}
public class App8_5 {
    public static void main(String[] args) {
        Person8_5 per=new Student8_5("王永涛",24,"电子");
        per.show();
        /*
        父类对象调用子类函数时，只限于“覆盖”的情况，子类专有的函数不可访问，否则会报错
        per.subshow();
         */
    }
}
